﻿@using ForzaGT3.Data
@using ForzaGT3.Areas.Admin.Models
@model SeriesModel
@{
    List<SelectListItem> CountryList = new List<SelectListItem>();
    IEnumerable<Country> Countries = Country.GetAll();
    foreach (Country data in Countries)
    {
        SelectListItem item = new SelectListItem();
        item.Text = data.Name;
        item.Value = data.CountryId.ToString();
        CountryList.Add(item);
    }

    List<SelectListItem> CircuitList = new List<SelectListItem>();
    IEnumerable<Circuit> circuits = Circuit.GetAll();
    foreach (Circuit data in circuits)
    {
        SelectListItem item = new SelectListItem();
        item.Text = data.Name;
        item.Value = data.CircuitId.ToString();
        CircuitList.Add(item);
    }
}
<div class="well">
    @using (Html.BeginForm(MVC.Admin.Series.Add(), FormMethod.Post, new { @class = "form-horizontal", @enctype = "multipart/form-data" }))
    {
        <fieldset>
            <div id="legend" class="">
                <legend class="">Add Series</legend>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label" for="input01">
                    Short Title</label>
                <div class="controls">
                    @Html.TextBoxFor(x => x.ShortTitle, new { @placeholder = "Short Title", @class = "input-xlarge" })
                    <p class="help-block">
                        @Html.ValidationMessageFor(x => x.ShortTitle)</p>
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label" for="input01">
                    Title</label>
                <div class="controls">
                    @Html.TextBoxFor(x => x.Title, new { @placeholder = "Title", @class = "input-xlarge" })
                    <p class="help-block">
                        @Html.ValidationMessageFor(x => x.Title)</p>
                </div>
            </div>
           
            <div class="control-group">
                <!-- Select Basic -->
                <label class="control-label">
                    Circuit</label>
                <div class="controls">
                    @Html.DropDownListFor(x => x.CircuitId, CircuitList, new { @class = "input-xlarge" })
                    <a href="@Url.Action(MVC.Admin.Circuit.Add())"  type="button"
                        class="btn">
                        Add New Circuit</a>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">
                    Banner Image</label>
                <!-- File Upload -->
                <div class="controls">
                    @Html.TextBoxFor(m => m.BannerImage, new { @type = "file", @class = "input-file" })
                    @Html.ValidationMessageFor(m => m.BannerImage)
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">
                    Start Date</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.StartDate, new { @class = "input-xlarge datepicker"})
                    @Html.ValidationMessageFor(m => m.StartDate)
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">
                    Finish Date</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.FinishDate, new { @class = "input-xlarge datepicker" })
                    @Html.ValidationMessageFor(m => m.FinishDate)
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">
                    Qualifiying Race Date</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.QualifyingRaceDate, new { @class = "input-xlarge datetimepicker" })
                    @Html.ValidationMessageFor(m => m.QualifyingRaceDate)
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">
                    Championship Date</label>
                <div class="controls">
                    @Html.TextBoxFor(m => m.ChampionshipRaceDate, new { @class = "input-xlarge datetimepicker"})
                    @Html.ValidationMessageFor(m => m.ChampionshipRaceDate)
                </div>
            </div>
            <div class="control-group">
                <!-- Textarea -->
                <label class="control-label">
                    Series Info</label>
                <div class="controls">
                    <div class="textarea">
                        @Html.TextAreaFor(m => m.Remarks, new { @class = "tinymce", @maxlength = "8000" })
                    </div>
                </div>
            </div>
            <br />
            <div class="control-group">
                <!-- Textarea -->
                <label class="control-label">
                    Series Info English</label>
                <div class="controls">
                    <div class="textarea">
                        @Html.TextAreaFor(m => m.RemarksEnglish, new { @class = "tinymce", @maxlength = "8000" })
                    </div>
                </div>
            </div>
            <div class="control-group">
                <!-- Form Actions -->
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">
                        Save changes</button>
                    <button onclick="javascript:location.href='/Admin/Series';" type="button"
                        class="btn">
                        Cancel</button>
                </div>
            </div>
        </fieldset>
    }
</div>
<script type="text/javascript" src="@Links.Areas.Admin.Assets.tinymce.jscripts.tiny_mce.tiny_mce_js"></script>
<script type="text/javascript">
    $(function () {
        var currentTime = new Date();
        var years = currentTime.getFullYear();
        var months = currentTime.getMonth();
        var days = currentTime.getDate();

        $(".datepicker").datepicker({
            dateFormat: 'yy-mm-dd',
            minDate: new Date(years, months, days)
        });

        $(".datetimepicker").datetimepicker({
            dateFormat: 'yy-mm-dd',
            minDate: new Date(years, months, days)
        });
    });

    tinyMCE.init({
        // General options
        mode: "specific_textareas",
        editor_selector: "tinymce",
        theme: "advanced",
        plugins: "autolink,lists,pagebreak,style,layer,table,save,advhr,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

        // Theme options
        theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect,|,insertdate,inserttime,preview,|,fullscreen",
        theme_advanced_buttons2: "forecolor,backcolor,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,help,code",
        //theme_advanced_buttons2: "forecolor,backcolor,|,cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,cleanup,help,code",
        // theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl,|,restoredraft,styleprops",
        theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,advhr,|,ltr,rtl,|,restoredraft,styleprops",
        theme_advanced_buttons4: "",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,
        maxlength: 1000,
        // Skin options
        skin: "o2k7",
        skin_variant: "silver"
    });
</script>